package exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *    自定义异常类
 * @author xiehaidong
 */
@Data
public class XueChengException extends RuntimeException{
    private int code;
    private String errorMessage;
    public static  void cast(CommonError commonError){
        throw  new XueChengException(commonError.getErrorCode(), commonError.getErrorMessage());
    }
    public static  void cast(int code,String errorMessage){
        throw  new XueChengException(code,errorMessage);
    }
    public XueChengException(){
        super();
    }
public XueChengException(int code,String errorMessage){
        this.code=code;
        this.errorMessage=errorMessage;
}
}
